context_tablename = '';
tableContextMenu = new dynContext('tableContextMenu', 'include/css/dynContext/dynContext.xp.css', 165, 0);
tableContextMenu.addItem(new dynContext_menuItem('<b><?php echo lang('Properties')?></b>', 'parent.tableContextMenu_onclick(\'properties\')'));
tableContextMenu.addItem(new dynContext_menuItem('<?php echo lang('Browse')?>', 'parent.tableContextMenu_onclick(\'browse\')'));
tableContextMenu.addItem(new dynContext_menuItem('<?php echo lang('Query')?>', 'parent.tableContextMenu_onclick(\'query\')'));
tableContextMenu.addItem(new dynContext_menuItem('<?php echo lang('Insert')?>', 'parent.tableContextMenu_onclick(\'insert\')'));
tableContextMenu.addItem(new dynContext_separator());
tableContextMenu.addItem(new dynContext_menuItem('<?php echo lang('Empty')?>', 'parent.tableContextMenu_onclick(\'empty\')'));
tableContextMenu.addItem(new dynContext_menuItem('<?php echo lang('Drop')?>', 'parent.tableContextMenu_onclick(\'drop\')'));
tableContextMenu.setAutoHeight();
tableContextMenu.buildAllMenus();
function showTableContextMenu(tablename)
{
	if (!window.createPopup || event.ctrlKey) return true;
	context_tablename = tablename;
	tableContextMenu.show();
	return false;
}
function tableContextMenu_onclick(menuItem)
{
	switch (menuItem)
	{
		case 'properties':
			top.rightFrame.location.href = '<?php echo common::url('../table.php')?>&table=' + context_tablename;
			break;
		case 'browse':
			top.rightFrame.location.href = '<?php echo common::url('../query.php')?>&sql=' + encodeURIComponent('SELECT * FROM ' + context_tablename);
			break;
		case 'query':
			top.rightFrame.location.href = '<?php echo common::url('../query.php')?>&table=' + context_tablename;
			break;
		case 'insert':
			top.rightFrame.location.href = '<?php echo common::url('../row.php?action=insert')?>&table=' + context_tablename + '&redirect=' + top.frames['rightFrame'].location.href;
			break;
		case 'empty':
			if (confirm('<?php echo lang('Are you sure you want to delete all rows from this table?')?>')) top.rightFrame.location.href = '<?php echo common::url('../table.php?action=empty')?>&table=' + context_tablename;
			break;
		case 'drop':
			if (confirm('<?php echo lang('Are you sure you want to drop this table?')?>'))
			{
				top.rightFrame.location.href = '<?php echo common::url('../table.php?action=drop')?>&table=' + context_tablename;
				location.refresh();
			}
			break;
	}
}
context_viewname = '';
viewContextMenu = new dynContext('viewContextMenu', 'include/css/dynContext/dynContext.xp.css', 165, 0);
viewContextMenu.addItem(new dynContext_menuItem('<b><?php echo lang('Properties')?></b>', 'parent.viewContextMenu_onclick(\'properties\')'));
viewContextMenu.addItem(new dynContext_menuItem('<?php echo lang('Browse')?>', 'parent.viewContextMenu_onclick(\'browse\')'));
viewContextMenu.addItem(new dynContext_menuItem('<?php echo lang('Query')?>', 'parent.viewContextMenu_onclick(\'query\')'));
viewContextMenu.addItem(new dynContext_separator());
viewContextMenu.addItem(new dynContext_menuItem('<?php echo lang('Drop')?>', 'parent.viewContextMenu_onclick(\'drop\')'));
viewContextMenu.setAutoHeight();
viewContextMenu.buildAllMenus();
function showViewContextMenu(viewname)
{
	if (!window.createPopup || event.ctrlKey) return true;
	context_viewname = viewname;
	viewContextMenu.show();
	return false;
}
function viewContextMenu_onclick(menuItem)
{
	switch (menuItem)
	{
		case 'properties':
			top.rightFrame.location.href = '<?php echo common::url('../view.php')?>&view=' + context_viewname;
			break;
		case 'browse':
			top.rightFrame.location.href = '<?php echo common::url('../query.php')?>&sql=' + encodeURIComponent('SELECT * FROM ' + context_viewname);
			break;
		case 'query':
			top.rightFrame.location.href = '<?php echo common::url('../query.php')?>';
			break;
		case 'drop':
			if (confirm('<?php echo lang('Are you sure you want to drop this view?')?>'))
			{
				top.rightFrame.location.href = '<?php echo common::url('../view.php?action=drop')?>&view=' + context_viewname;
				location.refresh();
			}
			break;
	}
}
<?php
exit;
?>